/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author owtee
 */
@Entity
@Table(name = "job_period")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "JobPeriod.findAll", query = "SELECT j FROM JobPeriod j"),
    @NamedQuery(name = "JobPeriod.findByPeriodId", query = "SELECT j FROM JobPeriod j WHERE j.periodId = :periodId"),
    @NamedQuery(name = "JobPeriod.findByPeriodName", query = "SELECT j FROM JobPeriod j WHERE j.periodName = :periodName"),
    @NamedQuery(name = "JobPeriod.findByActiveFlag", query = "SELECT j FROM JobPeriod j WHERE j.activeFlag = :activeFlag"),
    @NamedQuery(name = "JobPeriod.findByCreateUser", query = "SELECT j FROM JobPeriod j WHERE j.createUser = :createUser"),
    @NamedQuery(name = "JobPeriod.findByCreateDate", query = "SELECT j FROM JobPeriod j WHERE j.createDate = :createDate"),
    @NamedQuery(name = "JobPeriod.findByModifyUser", query = "SELECT j FROM JobPeriod j WHERE j.modifyUser = :modifyUser"),
    @NamedQuery(name = "JobPeriod.findByModifyDate", query = "SELECT j FROM JobPeriod j WHERE j.modifyDate = :modifyDate")})
public class JobPeriod implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Period_Id")
    private Integer periodId;
    @Size(max = 50)
    @Column(name = "Period_Name")
    private String periodName;
    @Column(name = "Active_Flag")
    private Boolean activeFlag;
    @Size(max = 10)
    @Column(name = "Create_User")
    private String createUser;
    @Column(name = "Create_Date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    @Size(max = 10)
    @Column(name = "Modify_User")
    private String modifyUser;
    @Column(name = "Modify_Date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date modifyDate;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "periodId")
    private Collection<Jobs> jobsCollection;

    public JobPeriod() {
    }

    public JobPeriod(Integer periodId) {
        this.periodId = periodId;
    }

    public Integer getPeriodId() {
        return periodId;
    }

    public void setPeriodId(Integer periodId) {
        this.periodId = periodId;
    }

    public String getPeriodName() {
        return periodName;
    }

    public void setPeriodName(String periodName) {
        this.periodName = periodName;
    }

    public Boolean getActiveFlag() {
        return activeFlag;
    }

    public void setActiveFlag(Boolean activeFlag) {
        this.activeFlag = activeFlag;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getModifyUser() {
        return modifyUser;
    }

    public void setModifyUser(String modifyUser) {
        this.modifyUser = modifyUser;
    }

    public Date getModifyDate() {
        return modifyDate;
    }

    public void setModifyDate(Date modifyDate) {
        this.modifyDate = modifyDate;
    }

    @XmlTransient
    public Collection<Jobs> getJobsCollection() {
        return jobsCollection;
    }

    public void setJobsCollection(Collection<Jobs> jobsCollection) {
        this.jobsCollection = jobsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (periodId != null ? periodId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JobPeriod)) {
            return false;
        }
        JobPeriod other = (JobPeriod) object;
        if ((this.periodId == null && other.periodId != null) || (this.periodId != null && !this.periodId.equals(other.periodId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.JobPeriod[ periodId=" + periodId + " ]";
    }
    
}
